#ifndef __INTERRUPT_H__
#define __INTERRUPT_H__

#include "ch32v_def.h"

#ifndef EXTI_IRQ_PRIO
#define EXTI_IRQ_PRIO 3
#endif /* EXTI_IRQ_PRIO */
#ifndef EXTI_IRQ_SUBPRIO
#define EXTI_IRQ_SUBPRIO 0
#endif

#ifdef __cplusplus
    #include <functional>

    using callback_func_t = std::function<void(void)>;
    void adapte_interrupt_enable(GPIO_TypeDef *port, uint16_t pin, callback_func_t callback, uint32_t mode);
#endif

void adapte_interrupt_enable(GPIO_TypeDef *port, uint16_t pin, void (*callback)(void), uint32_t mode);
void adapte_interrupt_disable(GPIO_TypeDef *port, uint16_t pin);
#endif // __INTERRUPT_H__